<template>
	<view>
		<view class="watermark_make">
			<view class="watermark_list">
				<view class="watermark_item" v-for="i in 100" :key="i">
					{{ txt}}
				</view>
			</view>
		</view>
		<slot></slot>
	</view>
</template>

<script>
	export default {
		name: "watermark",
		data() {
			return {
				txt: '',
			}
		},
		created() {
			this.updateWatermarkText()
		},
		methods: {
			updateWatermarkText() {
				var userInfo = uni.getStorageSync("userInfo");
				if (userInfo && userInfo.userCode && userInfo.userName) {
					const date = new Date()
					let year = date.getFullYear();
					let month = date.getMonth() + 1;
					let day = date.getDate();
					var time = year + "-" + month + "-" + day + " " + date.getHours() + ":" + date.getMinutes() + ":" +
						date.getSeconds();
					this.txt = userInfo.userCode + "--" + userInfo.userName + " " + time;
				} else
					this.txt = "寰宇·青岛智能工厂"
			}
		}
	}
</script>

<style lang="scss" scoped>
	.watermark_make {
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: 9999;
		background: rgba(0, 0, 0, 0);
		pointer-events: none;

		.watermark_list {
			width: 500%;
			height: 400%;
			position: absolute;
			top: -50%;
			left: -50%;
			transform: rotate(-45deg);
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			pointer-events: none;

			.watermark_item {
				font-size: 14px;
				color: rgba(220, 220, 220, 0.3);
				font-weight: bold;
				padding: 30rpx;
				pointer-events: none;
			}
		}
	}
</style>